<?php
require_once('inc_admin.php');
 connect();
if(!empty($_FILES["pic"]["name"])){
    $pic = uploadfile('pic',UserPhotoPath,array('png','jpg','gif'));
}
  //var_dump($_FILES["pic"]);
    //exit();
  /*if(!empty($_FILES["pic"]["name"])){
    $pic = uploadfile('pic','../neuvideo-v1/images/',array('jpg','gif','png'));
   }*/
   else{
    $pic='';
   }
 $data = array(
    'videoname' => trim($_POST['videoname']),
    'tid' => $_POST['tid'],
    'pic' => $pic,
    'intro'=> $_POST['intro'],
    'address' => $_POST['address']);
  //var_dump($data);
  $result = add('videos',$data);

  //echo $result;
  //执行SQL语句

  if(!$result){
    echo "添加失败！<br/>";
    echo "<a href='video-form.html'>返回</a>";    
  }else{    

  redirect('video-list.php',"添加成功！");
  }    
?>


